<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<body>
<style type="text/css">
	#teacherHome{
		padding: 15px;
		background: #fff;
		border-radius: 10px;
	}
	.layui-inline{
		width:30%;
	}
	.layui-input-block{
		margin-left: 135px;
	}
	.layui-form-label{
		width: 100px;
	}
</style>
<div id="teacherHome">
	<fieldset class="layui-elem-field layui-field-title site-title">
		<legend><a name="fixbar">教师信息</a></legend>
	</fieldset>
	<form id="tbClassForm" method="post" class="layui-form white-bg radius">
		<input type = "hidden" name = "limit" value="${param.limit}">
		<input type = "hidden" name = "page" value="${param.page}">
		<input type="hidden" name="id" value="${model.id}">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">师资类型</label>
				<div class="layui-input-block">
				<select name = "type">
						<c:forEach items="${data}" var="data">
							<option value="${data.name}" <c:if test="${fn:contains(model.type,data.name)}">selected="selected"</c:if>>${data.name}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="name" value="${model.name}">
					
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">性别</label>
				<div class="layui-input-block">
					<select name = "sex">
						<option value="男" <c:if test="${model.sex == '男'}">selected</c:if>>男</option>
						<option value="女" <c:if test="${model.sex == '女'}">selected</c:if>>女</option>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">民族</label>
				<div class="layui-input-block">
					<%-- <input type="text" class="layui-input" name="nation" value="${model.nation}"> --%>
					<select name = "nation">
						<c:forEach items="${data1}" var="data">
							<option value="${data.name}" <c:if test="${fn:contains(model.nation,data.name)}">selected="selected"</c:if>>${data.name}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">身份证号</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input"lay-verify="required" name="idcode" value="${model.idcode}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">出生日期</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" id="born" name="born" value="${model.born}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">政治面貌</label>
				<div class="layui-input-block">
				<%-- 	<input type="text" class="layui-input" name="politics" value="${model.politics}"> --%>
				<select name = "politics">
						<c:forEach items="${data2}" var="data">
							<option value="${data.name}" <c:if test="${fn:contains(model.politics,data.name)}">selected="selected"</c:if>>${data.name}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">最高学历</label>
				<div class="layui-input-block">
					<%-- <input type="text" class="layui-input" name="degree" value="${model.degree}"> --%>
					<select name = "degree">
						<c:forEach items="${data3}" var="data">
							<option value="${data.name}" <c:if test="${fn:contains(model.degree,data.name)}">selected="selected"</c:if>>${data.name}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">专业</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="speciality" value="${model.speciality}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">毕业院校</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="college" value="${model.college}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">参加工作时间</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" id="graduationdate" name="graduationdate" value="${model.graduationdate}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">执教时间</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" id="teachingdate" name="teachingdate" value="${model.teachingdate}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">工作单位</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="company" value="${model.company}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">职务</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="job" value="${model.job}">
					<%-- <select name = "job">
						<c:forEach items="${data4}" var="data">
							<option value="${data.name}" <c:if test="${fn:contains(model.job,data.name)}">selected="selected"</c:if>>${data.name}</option>
						</c:forEach>
					</select> --%>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">职称</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="title" value="${model.title}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">单位地址</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="address" value="${model.address}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">手机</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="phone" value="${model.phone}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">车牌号</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="carnumber" value="${model.carnumber}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<%-- <div class="layui-inline">
				<label class="layui-form-label">课程名称</label>
				<div class="layui-input-block">
					<select name = "curriculum.id">
						<c:forEach items="${Teacher}" var = "c">
							<option value="${c.id}" <c:if test='${model.curriculum.id == c.id}'>selected</c:if>>${c.courseName}</option>
						</c:forEach>
					</select>
				</div>
			</div> --%>
			<div class="layui-inline">
				<label class="layui-form-label">角色</label>
				<div class="layui-input-block">
					<input id="roleIds" type="hidden" name="roleIds" value="${model.roleCodes}">
					<select  multiple="multiple" lay-filter="roleIds">
						<c:forEach items="${roles}" var="role">
							<option value="${role.code}" <c:if test="${fn:contains(model.roleCodes,role.code)}">selected="selected"</c:if>>${role.name}</option>
						</c:forEach>
					</select>
				</div>
			</div>
		</div>
		
	</form>
</div>
<script type="text/javascript">
	form=layui.form;
	//form.render('select');
	layui.use(['laydate','multiSelect'], function(){
		var multiSelect=layui.multiSelect;
		var laydate = layui.laydate;
		multiSelect.render('select');
		laydate.render({
			elem: '#born',
		});
		laydate.render({
			elem: '#graduationdate',
		});
		laydate.render({
			elem: '#teachingdate',
		});
		form.on('select(roleIds)',function(data){
			var vals="";
			//console.info($(this).parent().children().find('div.layui-form-checked').parent());
			$(this).parent().children().find('div.layui-form-checked').parent().each(function(){
				vals+=$(this).attr('lay-value')+',';
				
			});
			vals=vals.length>0?vals.substring(0,vals.length-1):'';
			//console.info(vals);
			$('#roleIds').val(vals);
		})

		
	});
</script>
</body>
